﻿ 	<!DOCTYPE HTML>
 	<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>HTML5其他功能</title>
	<style>
		 #map{ width:400px; height:200px; border:1px #000 solid; }
	</style>
	</head>
	<body>
		 <input type="button" value="点击" id="input1">
		 <br>
		 <div id="map"></div>
	</body>
	<script src="http://api.map.baidu.com/api?v=1.3"></script>
	<script>
		 var oInput = document.getElementById('input1');
		 oInput.onclick = function(){	
	 	 var timer =
		     navigator.geolocation.getCurrentPosition(function(position){
		 var map = new BMap.Map("map");
		 var point = new BMap.Point(position.coords.longitude,
		     position.coords.latitude);
		 map.centerAndZoom(point, 15); 
	 	 var marker = new BMap.Marker(point);
		 map.addOverlay(marker);
		 map.enableScrollWheelZoom(true); 
		 var opts = {
		     width : 200,
		     height: 100,
		     title : "天丰利商城" ,
		     enableMessage:true,
		     message:"千锋教育，点击查看"
		 }
		 var infoWindow = new BMap.InfoWindow("地址：北京市海淀区宝盛北里西区28号", opts);  
		 map.openInfoWindow(infoWindow,point);	
		 },function(error){
		     console.log(error.code);
		 });	
	    };
	</script>
